import React, { lazy } from 'react'
import {Navigate, type RouteObject} from 'react-router-dom'


const lazyLoadRouteElement = (importFunction: () => Promise<{default: React.ComponentType}>) => {
const LazyComponent = lazy(importFunction)
return <LazyComponent />
}


const routes: RouteObject[] = [
    {
        path: '/',
        element: <Navigate to='/home' />
    },{
    path: '/home',
    element: lazyLoadRouteElement(()=> import('@/views/home/index.tsx'))
},
{
    path: '/404',
    element: lazyLoadRouteElement(()=> import('@/views/error/notFound/index'))
}]

export default routes